﻿using System;
using System.Linq.Expressions;
using Domain.Core.Specification;
using Domain.MainModule.Entities;

namespace Domain.MainModule.RateParamTypes
{
    public class RateParamTypeIdSpecification : Specification<RateParamType>
    {
        #region public properties

        public Guid TypeId
        {
            get;
            set;
        }

        #endregion

        #region constructor

        public RateParamTypeIdSpecification(Guid typeId)
        {
            this.TypeId = typeId;
        }

        #endregion

        #region public methods

        public override Expression<Func<RateParamType, bool>> SatisfiedBy()
        {
            Specification<RateParamType> spec = new TrueSpecification<RateParamType>();
            spec &= new DirectSpecification<RateParamType>(c => c.TypeId == this.TypeId);

            return spec.SatisfiedBy();
        }

        #endregion
    }
}
